home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / HandHeldPCPro30 / sdk.exe / Jupiter SDK / data1.cab / MFC / src / appterm.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-19  |  2.4 KB  |  84 lines

  1. // This is a part of the Microsoft Foundation Classes C++ library.
  2. // Copyright (C) 1992-1998 Microsoft Corporation
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Microsoft Foundation Classes Reference and related
  7. // electronic documentation provided with the library.
  8. // See these sources for detailed information regarding the
  9. // Microsoft Foundation Classes product.
  10.  
  11. #include "stdafx.h"
  12. #ifndef _INC_DDEMLH
  13. #include <ddeml.h> // for MSGF_DDEMGR
  14. #endif
  15.  
  16. #ifdef AFX_TERM_SEG
  17. #pragma code_seg(AFX_TERM_SEG)
  18. #endif
  19.  
  20. #ifdef _DEBUG
  21. #undef THIS_FILE
  22. static char THIS_FILE[] = __FILE__;
  23. #endif
  24.  
  25. /////////////////////////////////////////////////////////////////////////////
  26. // other globals (internal library use)
  27.  
  28. /////////////////////////////////////////////////////////////////////////////
  29. // Standard cleanup called by WinMain and AfxAbort
  30.  
  31. void AFXAPI AfxWinTerm(void)
  32. {
  33.     // unregister Window classes
  34.     AFX_MODULE_STATE* pModuleState = AfxGetModuleState();
  35.     AfxLockGlobals(CRIT_REGCLASSLIST);
  36.     LPTSTR lpsz = pModuleState->m_szUnregisterList;
  37.     while (*lpsz != 0)
  38.     {
  39.         LPTSTR lpszEnd = _tcschr(lpsz, '\n');
  40.         ASSERT(lpszEnd != NULL);
  41.         *lpszEnd = 0;
  42.         UnregisterClass(lpsz, AfxGetInstanceHandle());
  43.         lpsz = lpszEnd + 1;
  44.     }
  45.     pModuleState->m_szUnregisterList[0] = 0;
  46.     AfxUnlockGlobals(CRIT_REGCLASSLIST);
  47.  
  48. #if !defined(_WIN32_WCE_NO_OLE)
  49.     // cleanup OLE if required
  50.     CWinThread* pThread = AfxGetApp();
  51.     if (pThread != NULL && pThread->m_lpfnOleTermOrFreeLib != NULL)
  52.         (*pThread->m_lpfnOleTermOrFreeLib)(TRUE, FALSE);
  53. #endif // _WIN32_WCE_NO_OLE
  54.  
  55.     // cleanup thread local tooltip window
  56.     _AFX_THREAD_STATE* pThreadState = AfxGetThreadState();
  57. #if !defined(_WIN32_WCE_NO_TOOLTIPS)
  58.     if (pThreadState->m_pToolTip != NULL)
  59.     {
  60.         if (pThreadState->m_pToolTip->DestroyToolTipCtrl())
  61.             pThreadState->m_pToolTip = NULL;
  62.     }
  63. #endif // _WIN32_WCE_NO_TOOLTIPS
  64.  
  65. #if !defined(_WIN32_WCE)
  66.     if (!afxContextIsDLL)
  67.     {
  68.         // unhook windows hooks
  69.         if (pThreadState->m_hHookOldMsgFilter != NULL)
  70.         {
  71.             ::UnhookWindowsHookEx(pThreadState->m_hHookOldMsgFilter);
  72.             pThreadState->m_hHookOldMsgFilter = NULL;
  73.         }
  74.         if (pThreadState->m_hHookOldCbtFilter != NULL)
  75.         {
  76.             ::UnhookWindowsHookEx(pThreadState->m_hHookOldCbtFilter);
  77.             pThreadState->m_hHookOldCbtFilter = NULL;
  78.         }
  79.     }
  80. #endif // _WIN32_WCE
  81. }
  82.  
  83. /////////////////////////////////////////////////////////////////////////////
  84.